<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>订单修改</title>
    <!--    <link rel="icon" href="favicon.ico" type="image/ico">-->
    <!--    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">-->
    <!--    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">-->
    <meta name="author" content="yinqi">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/css/style.min.css}" rel="stylesheet">
    <script th:src="@{/js/jquery.js}"></script>
    <!--    &lt;!&ndash;时间选择插件&ndash;&gt;-->
    <!--    <link rel="stylesheet" th:href="@{/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css}">-->
    <!--    &lt;!&ndash;日期选择插件&ndash;&gt;-->
    <!--    <link rel="stylesheet" th:href="@{/js/bootstrap-datepicker/bootstrap-datepicker3.min.css}">-->
</head>
<body>
<br>
<br>
<form class="form-horizontal" method="post" onsubmit="return false;">
<!--    <div align="center" class="form-group">-->
<!--        <label  class="col-md-3 control-label" >订单编号</label>-->
<!--        <div class="col-md-7">-->
<!--            <input  style="width: 400px"  th:width="400px" class="text" type="text" name="orderId"  >-->
<!--        </div>-->
<!--    </div>-->
    <div align="center" class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span><h3>添加订单信息</h3></strong></div>
    <br>
    <br>

    <div align="center" class="form-group">
        <label  class="col-md-4 control-label" >汽车品牌</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="brand" th:value="${cars.carNames}"  >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >汽车型号</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="type" th:value="${cars.carVersions}"  >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >汽车颜色</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="color" th:value="${cars.carColors}" >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >售价</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="sellingPrice"  >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >销售人员</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="salesmanName"   >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >销售人员ID</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="salesmanId"  >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >销售时间</label>
        <div class="col-md-5">
            <input  style="width: 400px" class="form-control js-datetimepicker" type="date"  name="sellingTime" placeholder="请选择具体时间"  data-locale="zh-cn" data-format="YYYY-MM-DD HH:mm" />
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >付款类型</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="payment"  >
        </div>
    </div>
    <div align="center" class="form-group">
        <label class="col-md-4 control-label" >销售人员提成</label>
        <div class="col-md-5">
            <input style="width: 400px" class="form-control" type="text" name="royalty"  >
        </div>
    </div>
    <br>
    <div align="center">

        <div class="button-group">
            <a class="btn btn-success m-r-5" type="button" th:onclick="sub()">确定提交</a>

            <a class="btn btn-danger m-r-5" type="button" th:onclick="fanhui()">返回</a>
        </div>
    </div>
</form>
</body>
<script th:inline="javascript">

    function fanhui() {
        location.href = [[@{/car/pageCar}]];
    }

    function sub() {
        var brand = $("[name= 'brand']").val();
        var type = $("[name= 'type']").val();
        var color = $("[name= 'color']").val();
        var sellingPrice = $("[name= 'sellingPrice']").val();
        var salesmanName = $("[name= 'salesmanName']").val();
        var salesmanId = $("[name= 'salesmanId']").val();
        var sellingTime = $("[name= 'sellingTime']").val();
        var payment = $("[name= 'payment']").val();
        var royalty = $("[name= 'royalty']").val();
        $.ajax({
            url:[[@{/order/add}]],
        type:"post",
            data:{
                "brand":brand,
                "type":type,
                "color":color,
                "sellingPrice":sellingPrice,
                "salesmanName":salesmanName,
                "salesmanId":salesmanId,
                "sellingTime":sellingTime,
                "payment":payment,
                "royalty":royalty,
        },
        success:function (data) {
            if (data.status == 200) {
                alert(data.message);
                location.href=[[@{/order/pageOrder}]];
            } else {
                alert(data.message)
            }
        }
        });

    }
</script>
</html>